package com.bwie.controller;

import com.bwie.pojo.TbType;
import com.bwie.service.TbTypeService;
import com.bwie.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

/**
 * @Author: badaotianqiong
 * @Date: 2025/6/23 14:40
 * @Description:
 **/
@RestController
@RequestMapping("/shop/index")
public class TypeController {
    @Autowired
    private TbTypeService tbTypeService;

    @PostMapping("getTypeList")
    public R getTypeList(){
        return tbTypeService.getTypeList();
    }

    @PostMapping("addType")
    public R addType(@RequestBody @Validated TbType tbType){
        return tbTypeService.addType(tbType);
    }

    @PostMapping("uploadImg")
    public R uploadImg(@RequestPart("file") MultipartFile file){
        return tbTypeService.uploadImg(file);
    }

    @PostMapping("getSelectTypeList")
    public R getSelectTypeList(){
        return tbTypeService.getSelectTypeList();
    }
}
